package com.FSD.experiment2;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;


public class UC1Activity extends Activity {

    private Button uc1Btn1;
    private Button uc1Btn2;
    private Button uc1Btn3;
    private Button uc1Btn4;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.uc1_activity);

        uc1Btn1 = findViewById(R.id.uc1Btn_1); //水平布局
        uc1Btn1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LinearLayout linearLayout = findViewById(R.id.uc1LinearLayout);
                linearLayout.setOrientation(LinearLayout.HORIZONTAL);
            }
        });

        uc1Btn2 = findViewById(R.id.uc1Btn_2);//垂直布局
        uc1Btn2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LinearLayout linearLayout = findViewById(R.id.uc1LinearLayout);
                linearLayout.setOrientation(LinearLayout.VERTICAL);
                linearLayout.setGravity(Gravity.CENTER);
            }
        });

        uc1Btn3 = findViewById(R.id.uc1Btn_3);//靠左对齐
        uc1Btn3.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("WrongConstant")
            @Override
            public void onClick(View v) {
                LinearLayout linearLayout = findViewById(R.id.uc1LinearLayout);
                linearLayout.setGravity(Gravity.CENTER_VERTICAL);
            }
        });





        uc1Btn4 = findViewById(R.id.uc1Btn_4);//返回按钮
        uc1Btn4.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
    }
}
